<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>余额记录</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
		<style type="text/css">
			#yue_jilu .left,#yue_jilu .center{width: 50%;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class=" mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">余额记录</h1>
		</header>
		<div class="mui-content record_content">
			<!--<ul class="record_nav clearfix">
				<li class="left">日期</li>
				<li class="center">说明</li>
				<li class="right">金额</li>
			</ul>-->
		    <ul class="record_list2" id="sj_score">
		    	<!--<li class="less clearfix">
		    		<div class="left">
		    			<p class="list_nam">九鼎国际养殖场</p>
		    			<p class="list_time">2017/4/17</p>
		    		</div>
		    		<div class="center">－66</div>
		    		<div class="right">20000</div>
		    	</li>-->
		    </ul>
		</div>
		<input type="hidden" id="cut_page" value="1" />
		<input type="hidden" id="total_num" value="1" />
		<input type="hidden" id="per_page" value="10" />
	</body>

</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>

<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript">
	var member = JSON.parse(localStorage.getItem('member'));
	$(function(){
		get_record();
	})
	
	
	
	function get_record(){
		$.ajax({
		url: APP.api_url + 'Wallet/yue_jilu',
		data: {
			token	: member['token'],
			uid		: getUid(),
			page	: $("#cut_page").val()
		},
		success: function(data) {
			if(data.code == 200) {
				var yueList = data.data;
				$("#total_num").val(data.total_num);
				
				var yue_htm = "";
				for(var i = yueList.length-1; i >=0; i--) {
					var sty="";
					var user_price;
					if(yueList[i].price>0){
						sty="style='color: #4AB319;'";
						user_price="+"+yueList[i].price;
					}else{
						user_price=yueList[i].price;
					}
					yue_htm +=	"<li class='less clearfix'>"+
		    					"<div class='left'>"+
		    						"<p class='list_nam'>"+yueList[i].remark+"</p>"+
					    			"<p class='list_time'>"+yueList[i].add_time+"</p>"+
		    					"</div>"+
		    					"<div class='right' "+sty+">"+user_price+"</div></li>";
				}
				$("#sj_score").append(yue_htm);
				
			} else {
				$("#sj_score").html('<p style="text-align:center;width: 100%;background-color: #fff;height: 35px;line-height: 35px;">暂无余额记录!!</p>');
				console.log(data.msg);
			}	
		}
	})
}
	
	//底部加载事件
	$(window).scroll(function() {
		if($(document).scrollTop()+1 >= $(document).height() - $(window).height()) {
			var total_num= $("#total_num").val();
			var per_page= $("#per_page").val();
			var page_total = Math.ceil(parseInt(total_num)/parseInt(per_page));
			var cut_page = $("#cut_page").val();
			
			if(cut_page<page_total){
				$("#cut_page").val(parseInt(cut_page) + 1);
				get_record();
			}else{
				layer.msg("已到底部");
			}
		}
	});
</script>
